//
//  STDSEffectManager.hpp
//  STDRenderSDK
//
//  Created by 陈学明 on 2023/3/13.
//  Copyright © 2023 陈学明. All rights reserved.
//

#ifndef STDSEffectManager_hpp
#define STDSEffectManager_hpp

#include "STDSShaderStream.hpp"
#include "STDSShaderProgram.hpp"

using namespace std;

class STDSEffectManager {
    
public:
    STDSEffectManager() {
        regShaderForCXM(shaderMap);
        regShaderForBlend(shaderMap);
    };
    
    ~STDSEffectManager() {
//        printf("dealloc--STDSEffectManager\n");
    };
    
    void initEffects();
    
    shared_ptr<STDSShaderProgram> getProgram(const string &effectName) {
        auto shader = shaderMap[effectName];
        if (shader == nullptr) {
            return nullptr;
        }
        auto program = make_shared<STDSShaderProgram>(shader->vex, shader->frag);
        return program;
    }
public:
    map<string, shared_ptr<STDSShaderStream>> shaderMap;
};
#endif /* ShaderSrcManager_hpp */
